<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // url => 资源 接口 json
        // https://api.github.com/users/webos
        (async function () {
            // const response = await fetch('https://api.github.com/users/webos') // Response
            // // await后Promise实例执行 resolve结果是一个promise的返回结果
            // const data = await response.json() // Promise
            // console.log(data)
            // const response2 = await fetch('https://api.github.com/users/shunwuyu') // Response
            // const data2 = await response2.json() // Promise
            // console.log(data2)
            // 
            const p1 = fetch('https://api.github.com/users/webos');
            const p2 = fetch('https://api.github.com/users/shunwuyu');
            const res = await Promise.all([p1, p2]) // static 并发执行 返回Promise
            console.log(res)
            dataPromises = res.map(r => r.json())
            const [wes, shun] = await Promise.all(dataPromises)
            console.log(wes, shun)
        })();
        // fetch('https://api.github.com/users/webos')// Promise 对象
        //     .then(data => data.json())
        //     .then(data => {
        //         console.log(data);
        //     })
    </script>
</body>

</html>